////
////  LCCKInputViewPluginPickImage.m
////  Pods
////
////  v0.8.5 Created by ElonChan on 16/8/11.
////
////
//
//#import "LCCKInputViewPluginConversationBackground.h"
//
//@interface LCCKInputViewPluginConversationBackground()<UIImagePickerControllerDelegate>
//
//@property (nonatomic, copy) LCCKIdResultBlock sendCustomMessageHandler;
//@property (nonatomic, copy) UIImagePickerController *pickerController;
//
//@end
//
//@implementation LCCKInputViewPluginConversationBackground
//@synthesize inputViewRef = _inputViewRef;
//@synthesize sendCustomMessageHandler = _sendCustomMessageHandler;
//
//#pragma mark -
//#pragma mark - LCCKInputViewPluginSubclassing Method
//
//+ (void)load {
//    [self registerCustomInputViewPlugin];
//}
//
//+ (LCCKInputViewPluginType)classPluginType {
//    return LCCKInputViewPluginTypeConversationBackground;
//}
//
//#pragma mark -
//#pragma mark - LCCKInputViewPluginDelegate Method
//
///*!
// * 插件图标
// */
//- (UIImage *)pluginIconImage {
//    return [self imageInBundlePathForImageName:@"chat_bar_icons_pic"];
//}
//
///*!
// * 插件名称
// */
//- (NSString *)pluginTitle {
//    return @"改背景";
//}
//
///*!
// * 插件对应的 view，会被加载到 inputView 上
// */
//- (UIView *)pluginContentView {
//    return nil;
//}
//
//- (void)pluginDidClicked {
//    [super pluginDidClicked];
//    //显示相册
//    [self.conversationViewController presentViewController:self.pickerController animated:YES completion:nil];
//}
//
//- (LCCKIdResultBlock)sendCustomMessageHandler {
//    if (_sendCustomMessageHandler) {
//        return _sendCustomMessageHandler;
//    }
//    LCCKIdResultBlock sendCustomMessageHandler = ^(id object, NSError *error) {
//        [self.conversationViewController dismissViewControllerAnimated:YES completion:nil];
//        if (object) {
//            UIImage *image = (UIImage *)object;
//            //            [self.conversationViewController sendImageMessage:image];
//            [[LCChatKit sharedInstance] setBackgroundImage:image forConversationId:self.conversationViewController.conversationId scaledToSize:self.conversationViewController.view.frame.size];
//        } else {
//            LCCKLog(@"%@", error.description);
//        }
//        _sendCustomMessageHandler = nil;
//    };
//    _sendCustomMessageHandler = sendCustomMessageHandler;
//    return sendCustomMessageHandler;
//}
//
//#pragma mark -
//#pragma mark - Private Methods
//- (UIImagePickerController *)pickerController {
//    if (_pickerController) {
//        return _pickerController;
//    }
//    _pickerController = [[UIImagePickerController alloc] init];
//    _pickerController.delegate = self;
//    return _pickerController;
//}
//
//- (UIImage *)imageInBundlePathForImageName:(NSString *)imageName {
//    UIImage *image = [UIImage lcck_imageNamed:imageName bundleName:@"ChatKeyboard" bundleForClass:[self class]];
//    return image;
//}
//
//#pragma mark - UIImagePickerControllerDelegate
//
//- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
//    UIImage *image = info[UIImagePickerControllerOriginalImage];
//    !self.sendCustomMessageHandler ?: self.sendCustomMessageHandler(image, nil);
//}
//
//- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
//    NSInteger code = 0;
//    NSString *errorReasonText = @"cancel image picker without result";
//    NSDictionary *errorInfo = @{
//                                @"code":@(code),
//                                NSLocalizedDescriptionKey : errorReasonText,
//                                };
//    NSError *error = [NSError errorWithDomain:NSStringFromClass([self class])
//                                         code:code
//                                     userInfo:errorInfo];
//    !self.sendCustomMessageHandler ?: self.sendCustomMessageHandler(nil, error);
//}
//
//@end
